package com.baidu.health.controller;

import com.baidu.health.service.WxPayService;
import com.baidu.health.util.Result;
import com.baidu.health.util.ResultResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by IntelliJ IDEA.
 * User: 孙新超
 *
 * @author 孙新超
 * @version 1.0
 * @date To change this template use File | Settings | File Templates.
 * @date
 */
@Api(tags = "微信支付")
@RestController
@RequestMapping("pay")
public class WxPayController {
    @Autowired
    private WxPayService service;
    //生成微信支付二维码返回值
    @ApiOperation("生成微信支付二维码")
    @PostMapping("unifiedOrder/{orderId}/{totolFee}/{body}")
    public Result unifiedOrder(@PathVariable Long orderId,
                               @PathVariable Integer totolFee,
                               @PathVariable(required = false)String body
                                       ) throws Exception {
        return service.unifiedOrder(orderId,totolFee,body);
    }
    //统一查询查询订单支付状态
    //查询订单支付状态
    @ApiOperation("查询订单支付状态")
    @PostMapping("wxOrderquery/{orderId}")
    public Result wxOrderquery(@PathVariable Long orderId) throws Exception {
        return service.wxOrderquery(orderId);
    }


}
